package com.cloud.consumer.controller;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * Created by yangguiyun on 2017/3/29.
 */
@RestController
public class ConsumerController {
    @Resource
    private RestTemplate restTemplate;
    @GetMapping("/consumer")
    public String consumer() {
        ResponseEntity<String> result = restTemplate.getForEntity("http://CLOUD-PROVIDER/provider", String.class);
        System.out.println(result.getStatusCodeValue());
        System.out.println(result.getStatusCode());
        System.out.println(result);
        return "consumer" + " " + result.getBody();
    }
}
